package com.situ.day11;

public class Student extends Person {
//    private int id;
//    private String name;
//    private int age;
    private String className;
    private int age;

    public Student() {
        //new Persson()
        super();
        System.out.println("Student.Student1");
    }

    //Java：new子类对象，首先要new出父类对象
    public Student(int id, String name, int age, String className) {
        //new Person(id,name,age)
        super(id, name, age);
        //this.id = id;
        //this.name = name;
        //this.age = age;
        this.className = className;
        System.out.println("Student.Student2");
    }

    /*public void show() {
        System.out.println(className);
        System.out.println(id);
        System.out.println(name);
    }*/

    //实例方法: new出一个对象才能调用
    public void study(){
        System.out.println("Student.study");
        System.out.println(age);
        System.out.println(super.age);
        this.show();
        show();
        super.show();
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    /*void show(int a, char b, double c){}
    int show(int x, char y, double z){
        return 0;
    }*/

    @Override
    public void show() {
        System.out.println("Student.show");
    }

    //重写、覆盖
    @Override
    public String toString() {
        return "Student{" +
                "className='" + className + '\'' +
                ", id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
